package com.grieous.wow.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.grieous.wow.dao.BatchDao;
import com.grieous.wow.dao.Page;
import com.grieous.wow.dao.GenericDao;
import com.grieous.wow.entity.Photo;

@Repository("photoDao")
public class PhotoDaoImpl extends SqlSessionDaoSupport implements GenericDao<Photo>,Page,BatchDao{

	@Override
	public int add(Photo photo) {
		return getSqlSession().insert("mybatis.mapper.PhotoMapper.insertPhoto",photo);
		
	}

	@Override
	public int update(Photo photo) {
		return getSqlSession().update("mybatis.mapper.PhotoMapper.updatePhoto",
				photo);
		
	}

	@Override
	public int delete(Map<String, Object> map) {
		return getSqlSession().delete("mybatis.mapper.PhotoMapper.deletePhoto",
				map);
		
	}

	@Override
	public List<Photo> findListByCondition(Map<String, Object> map) {
		return getSqlSession().selectList(
				"mybatis.mapper.PhotoMapper.getPhoto", map);
	}

	@Override
	public int findCountByCondition(Map<String, Object> map) {
		Object obj = getSqlSession().selectOne(
				"mybatis.mapper.PhotoMapper.getPhotoCount", map);
		return (Integer) (obj == null ? 0 : obj);
	}

	@Override
	public int update(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delete(Photo t) {
		// TODO Auto-generated method stub
		return 0;
	}

}
